#include<iostream>
using namespace std;

class A
{
public:
    A ()
    {
        cout << "a的构造函数" << endl;
    }
    ~A()
    {
        cout << "a的析构函数" << endl;
    }
    protected:
    int a;
};

class B : public A
{
public:
    B()
    {
        cout << "b的构造函数" << endl;
    }
    ~B()
    {
        cout << "b的析构函数" << endl;
    }
};

class C : public A
{
public:
    C()
    {
        cout << "c的构造函数" << endl;
    }
    ~C()
    {
        cout << "c的析构函数" << endl;
    }
};

class D : public B, public C
{
public:
    D()
    {
        cout << "d的构造函数" << endl;
    }
    ~D()
    {
        cout << "d的析构函数" << endl;
    }
};

int main()
{
    D d;
    //cout << d.a << endl; // 在构建时会构建两次A，所以d中同时存在A和B的a，d.a指定不明确
    return 0;
}
